﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Agresso.Interface.Layer.SQL
{
    public class KofaxInvoiceSQL
    {
        public static string InsertKofaxInvoice()
        {
            return @"INSERT INTO [i_KofaxInvoice]
           ([BatchClassId]
           ,[BatchClassName]
           ,[BatchStatus]
           ,[DocumentId]
           ,[DocumentClassName]
           ,[VendorCode]
           ,[VendorName]
           ,[InvoiceNo]
           ,[InvoiceDate]
           ,[SubTotal]
           ,[Tax]
           ,[TotalAmount]
           ,[PartNo]
           ,[Description]
           ,[Qty]
           ,[UnitPrice]
           ,[FileName]
           ,[PoNumber]
           ,[TotalPrice]
            ,[CreatedDate]
           ,[ModifiedDate]
           ,[pickup_flag])
     VALUES
           (@BatchClassId
           ,@BatchClassName
           ,@BatchStatus
           ,@DocumentId
           ,@DocumentClassName
           ,@VendorCode
           ,@VendorName
           ,@InvoiceNo
           ,@InvoiceDate
           ,@SubTotal
           ,@Tax
           ,@TotalAmount
           ,@PartNo
           ,@Description
           ,@Qty
           ,@UnitPrice
           ,@FileName
           ,@PoNumber
           ,@TotalPrice
            ,getdate()
            ,getdate(),
            ,'0')";
        }

        public static string SelectAllPendingInfoice()
        {
            return @"select distinct DocumentId from i_KofaxInvoice where pickup_flag = '0'";
        }

        public static string SelectAllPendingInfoiceByInvoice()
        {
            return @"select * from i_KofaxInvoice where pickup_flag = '0' and DocumentId=@DocumentId";
        }

        public static string UpdateKofaxInvoiceStatus()
        {
            return @"update i_KofaxInvoice set pickup_flag=@pickup_flag, ModifiedDate=getdate(), batch_id=@batch_id, remark=@remark where id = @id ";
        }
    }
}
